package cn.shutdown.demo.thread.suspend.lock02;

/**
 * @author jiangwujie
 * @date 2021/8/8
 */
public class SuspendLockTest {

    public static void main(String[] args) throws InterruptedException {
        SynchronizedObject synchronizedObject = new SynchronizedObject();
        Thread thread1 = new Thread() {

            @Override
            public void run() {
                synchronizedObject.printString();

            }
        };
        thread1.setName("a");

        thread1.start();

        Thread.sleep(10000);

        Thread thread2 = new Thread() {

            @Override
            public void run() {
                System.out.println("thread2启动了，但进入不了 synchronizedObject的printString方法，因为被独占锁锁了");
                synchronizedObject.printString();

            }
        };
        thread2.start();
    }

}
